﻿using System.Buffers;

namespace System.IO.Pipelines
{
    public sealed partial class Pipe : IReadableBuffer, IWriteableBuffer
    {
        public int BlockSize { get; }

        public long WrittenLength => this.Length;
        public long ReadableLength => this.Length;
        
        public Memory<byte> GetWritableMemory(int size)
        {
            return this.GetMemory(size);
        }

        public void WriterAdvance(int bytes)
        {
            this.Advance(bytes);
        }

        public ReadOnlySequence<byte> GetReadableMemory()
        {
            return this.Read();
        }

        public void ReaderAdvance(SequencePosition pos)
        {
            this.AdvanceReader(pos);
        }
    }
}

